package com.example.mymicaihu.adapter.home;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.example.mvplibrary.adapter.BaseAdapter;
import com.example.mvplibrary.adapter.BaseViewHolder;
import com.example.mymicaihu.R;
import com.example.mymicaihu.bean.GameBean;

import java.util.List;


/**
 * 作者：朱勇闯
 * data : 2021/4/25  17:02
 * 作用： xxxx
 */
public class GameAdapter3 extends BaseAdapter<GameBean.GameListBean> {
    public ItemListener itemListener;

    public void setItemListener(ItemListener itemListener) {
        this.itemListener = itemListener;
    }

    public GameAdapter3(List<GameBean.GameListBean> datas, Context context, int layoutId) {
        super(datas, context, layoutId);
    }

    @Override
    protected void bindData(BaseViewHolder holder, GameBean.GameListBean listBean, int position) {
        TextView title = holder.getView(R.id.tv_item_game2_class_title);
        TextView desc = holder.getView(R.id.tv_item_game2_class_desc);
        TextView score = holder.getView(R.id.tv_item_game2_class_score);
        TextView commnum = holder.getView(R.id.tv_item_game2_class_commnum);
        TextView type = holder.getView(R.id.tv_item_game2_class_type);
        ImageView head = holder.getView(R.id.iv_item_game2_head);
        ImageView big = holder.getView(R.id.iv_item_game2_class_big);

        title.setText(listBean.getArticleTitle());
        desc.setText(listBean.getSlogan());
        type.setText(listBean.getSourceType());
        score.setText(listBean.getGradeScore());
        commnum.setText(listBean.getCommentNum()+"评论");

        Glide.with(context).load(listBean.getAppIcon()).into(head);
        Glide.with(context).load(listBean.getThumbList().get(0)).into(big);
    }

    public interface ItemListener {
        void onItemClickListener(int pos);
    }
}
